<!DOCTYPE html>
<html>
<head>
    <title>Custom Drop Target Example</title>
    <script src="EventUtil.js"></script>
</head>
<body>
    <p>Try dragging the image over the square.</p>
    <p>Firefox will not navigate away because <code>ondrop</code> cancels the default action.</p>

    <img id="smiley" src="smile.gif">
    <div style="width: 100px; height: 100px; float: right; background: red" id="droptarget"></div>
    <div id="output"></div>
    <script>
        var droptarget = document.getElementById("droptarget");
        
        function handleEvent(event){
            document.getElementById("output").innerHTML += event.type + "<br>";
            if (event.type == "dropenter" || event.type == "dragover" || event.type=="drop"){
                EventUtil.preventDefault(event);
            }
        }

        EventUtil.addHandler(droptarget, "dragenter", handleEvent);
        EventUtil.addHandler(droptarget, "dragover", handleEvent);
        EventUtil.addHandler(droptarget, "dragleave", handleEvent);
        EventUtil.addHandler(droptarget, "drop", handleEvent);

    </script>
</body>
</html>
